FUNCTION

get_signature

pure function get_signature(data_hash: byte_array, privkey: byte_array): byte_array

Sign a 32-byte array with a 32-byte private key using the ECDSA (secp256k1) algorithm.

The given 32-byte array data_hash is typically a cryptographic hash obtained from a larger data structure using a hashing function such as hash(), sha256() or keccak256().

The returned value can be verified with verify_signature() using the public key belonging to the keypair of the given private key.

Parameters

  • data_hash — a 32-byte array to be signed
  • privkey — the 32-byte private key with which to sign

Returns

a 64-byte signature

Throws

  • exception — if either privkey or data_hash are not exactly 32 bytes long

Since

0.13.11

© 2026 Chromia